package com.origin;

import java.util.ArrayList;

public class QuestionBank implements Cloneable{

    private ArrayList<ChoiceQuestion> choiceQuestionList = new
            ArrayList<ChoiceQuestion>();
    private ArrayList<AnswerQuestion> answerQuestionList = new
            ArrayList<AnswerQuestion>();

    public QuestionBank append(ChoiceQuestion choiceQuestion) {
        choiceQuestionList.add(choiceQuestion);
        return this;
    }
    public QuestionBank append(AnswerQuestion answerQuestion) {
        answerQuestionList.add(answerQuestion);
        return this;
    }

    public Object clone() throws CloneNotSupportedException {
          QuestionBank questionBank = (QuestionBank) super.clone();
          questionBank.answerQuestionList = (ArrayList<AnswerQuestion>) answerQuestionList.clone();
          questionBank.choiceQuestionList = (ArrayList<ChoiceQuestion>) choiceQuestionList.clone();
          return questionBank;
    }

    @Override
    public String toString() {
        return "QuestionBank{" +
                "choiceQuestionList=" + choiceQuestionList +
                ", answerQuestionList=" + answerQuestionList +
                '}';
    }
}
